# alert、confirm、prompt 的处理
from selenium import webdriver
import time
import os
driver = webdriver.Chrome()
url = "file:///" + os.path.abspath("alert.html")
driver.get(url)
driver.maximize_window()
time.sleep(5)
driver.find_element_by_id("tooltip").click()
time.sleep(2)

# 定位弹出框/获取弹出框的操作句柄,为了以后的关闭他
alert = driver.switch_to.alert
time.sleep(3)

# 关闭alert
alert.accept()
time.sleep(3)
driver.quit()


